package com.thb.pay.api.merchant;


import com.thb.pay.api.merchant.fallback.MchPayChannelServiceApiFallbackFactory;
import com.thb.pay.api.merchant.vo.req.MchPayChannelPageReq;
import com.thb.pay.api.merchant.vo.req.MchPayChannelReq;
import com.thb.pay.api.merchant.vo.resp.MchPayChannelVo;
import com.thb.pay.core.utils.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "pay-service", fallbackFactory = MchPayChannelServiceApiFallbackFactory.class)
@RequestMapping("/mchPayChannelServiceApi")
public interface MchPayChannelServiceApi {

    @RequestMapping(value = "/findPage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    PageResult<MchPayChannelVo> findPage(@RequestBody MchPayChannelPageReq pageReq);

    @RequestMapping(value = "/findAllList", method = RequestMethod.GET)
    List<MchPayChannelVo> findAllList();

    @RequestMapping(value = "/findListByMerchantId", method = RequestMethod.GET)
    List<MchPayChannelVo> findListByMerchantId(@RequestParam("merchantId") Long merchantId);


    @RequestMapping(value = "/getByMerchantIdAndProductId", method = RequestMethod.GET)
    MchPayChannelVo getByMerchantIdAndProductId(@RequestParam("merchantId") Long merchantId, @RequestParam("productId") Long productId);

    @RequestMapping(value = "/findListByIds", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    List<MchPayChannelVo> findListByIds(@RequestBody List<Long> ids);

    @RequestMapping(value = "/getById", method = RequestMethod.GET)
    MchPayChannelVo getById(@RequestParam("id") Long id);

    @RequestMapping(value = "/add", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void add(@RequestBody MchPayChannelReq mchPayChannelReq);

    @RequestMapping(value = "/update", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void update(@RequestBody MchPayChannelReq mchPayChannelReq);

    @RequestMapping(value = "/deleteBatchIds", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void deleteBatchIds(List<Long> ids);

}
